// import { defineConfig } from 'vite'
// import vue from '@vitejs/plugin-vue'

// // https://vitejs.dev/config/
// export default defineConfig({
//   plugins: [vue()]
// })



import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 支持element-plus按需引入
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// import Inspect from 'vite-plugin-inspect'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    // 配置路径别名
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
  plugins: [
    vue(),
    AutoImport({
      imports: ['vue', 'vue-router'],     //  vue3  setup 语法糖下 不需要导入就可以直接使用一些属性 如 ref reactive 
      dts: 'src/auto-import.d.ts'
    }),
    AutoImport({
      resolvers: [
        ElementPlusResolver(),
         // 自动导入图标组件
        IconsResolver({
          prefix: 'Icon',
        }),   
      ],
      dts: 'src/auto-Notification.d.ts',
    }),
    Components({
      resolvers: [
        ElementPlusResolver(),
        // Auto register icon components
        // 自动注册图标组件
        IconsResolver({
          enabledCollections: ['ep'],
        }),
      ],
      dts: 'src/components.d.ts',
    }),
    Icons({
      autoInstall: true,
    }),
    // Inspect(),
  ],
  server: {
    port: 3000,
    proxy: {
      '/api': 'http://testapi.xuexiluxian.cn'
    }
  } 
})
//   
// {"username":"F94AFB9EC9951F387DA2779C76824A34","password":"1899DDEE9D860A0C452DD91844CB7A1C"}
// {"username":"F94AFB9EC9951F387DA2779C76824A34","password":"1899DDEE9D860A0C452DD91844CB7A1C"}
